<?
//团队业绩 推荐业绩
function updatehytdyj($curday,$userid,$leftyj1,$leftyj2,$leftnum1,$leftnum2,$tjyj,$tjnum,$gwpv=0){
	global $db,$db_prefix;
	//echo $leftyj1."|".$leftyj2."|".$leftnum1."|".$leftnum2."|".$tjyj."|".$tjnum."<bR>";
	$sqlq="select * from {$db_prefix}hyyj where userid='$userid' and curday='$curday'";
	$rsq=$db->get_one($sqlq);
	if ($rsq['id']){
		unset($dataArray);
		$dataArray['leftyj1']=$rsq['leftyj1']+$leftyj1;
		$dataArray['leftyj2']=$rsq['leftyj2']+$leftyj2;
		$dataArray['leftnum1']=$rsq['leftnum1']+$leftnum1;
		$dataArray['leftnum2']=$rsq['leftnum2']+$leftnum2;
		$dataArray['tjyj']=$rsq['tjyj']+$tjyj;
		$dataArray['tjnum']=$rsq['tjnum']+$tjnum;
		$dataArray['gwpv']=$rsq['gwpv']+$gwpv;
		$condition="userid='$userid' and curday='$curday'";
		$db->update("{$db_prefix}hyyj",$dataArray,$condition);
	}else{
		unset($dataArray);
		$dataArray['userid']=$userid;
		$dataArray['curday']=$curday;
		$dataArray['leftyj1']=$leftyj1;
		$dataArray['leftyj2']=$leftyj2;
		$dataArray['leftnum1']=$leftnum1;
		$dataArray['leftnum2']=$leftnum2;
		$dataArray['tjyj']=$tjyj;
		$dataArray['tjnum']=$tjnum;
		$dataArray['gwpv']=$gwpv;
		$db->insert("{$db_prefix}hyyj",$dataArray);
	}
	//更新会员的团队业绩
	$curhypv=$leftyj1+$leftyj2;
	if($curhypv>0){
		$sqlyj="update {$db_prefix}users set hytdpv=hytdpv+'$curhypv' where id='$userid'";
		$db->query($sqlyj);
	}
	return true;
}
?>